<link href="__PUBLIC__/static/mobile/css/rater.css" rel="stylesheet" type="text/css"/>


<div class="container" ng-controller="manageDetailController">
    <form name="manageForm" class="form-manage" novalidate>
        <div class="form-group wrap-col-head"
             ng-class="{ 'has-warning has-feedback' : manageForm.missionName.$invalid }">
            <h4 id="missionName" ng-show="(inputMissionName == 0 || status == 2) && manageForm.missionName.$valid" class="input-modify" ng-click="inputMissionName = 1">{{ mission.mission_name }}</h4>
            <input type="text" ng-hide="(inputMissionName == 0 || status == 2) && manageForm.missionName.$valid" id="inputMissionName"
                       name="missionName" required
                       class="form-control input-modify" ng-model="mission.mission_name"/>
            <span ng-show="manageForm.missionName.$invalid" class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"></span>
            <div class="warning"
                 ng-show="manageForm.missionName.$invalid">
                <small class="error"
                       ng-show="manageForm.missionName.$error.required">
                    任务标题不能为空
                </small>
            </div>
            <h6 class="text-tips">{{ getTimePast(mission.publish_time) }}发布</h6>
            <input type="hidden" id="missionId" value="<{$mission_id}>">
        </div>

        <!-- Valid time and public config -->
        <div class="row">
            <label for="inputValid" class="col-xs-12 control-label sm-label">任务有效期</label>
            <div class="col-xs-12">
                <select id="inputValid" class="form-control" ng-model="mission.valid_time" ng-options="m.value as m.name for m in validTimes">
                    <!--<option value="">--请选择--</option>-->
                </select>
            </div>
            <div class="col-xs-12">
                <h6 class="text-tips">选择后，任务有效期将从现在开始计算</h6>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" ng-model="isPhonePublic">发布本活儿时公开电话，结束后恢复原状态
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" ng-model="isAgentPublic">适用于您的代表机构（私活儿可不勾选）
                    </label>
                </div>
            </div>
        </div>

        <!-- Task description -->
        <div class="row">
            <div class="col-xs-12">
                <dl id="dl" class="dl-horizontal-single dl-modify">
                    <dt>岗位需求：</dt>
                    <dd class="input-modify dd-jobs" ng-click="clearInputs(); inputJobs = 1"><span ng-hide="inputJobs == 1 && status == 1">{{ mission.jobs }}&nbsp;</span><input type="hidden" name="job" ng-model="mission.jobs" required><ul ng-show="inputJobs == 1 && status == 1" class="ul-tag" id="inputJobs"><li ng-repeat="job in jobs" ng-class="{active: job.active == true}" ng-click="jobClick($index)">{{ job.stat_name }}</li></ul><div class="warning"
                             ng-show="manageForm.job.$invalid"><small class="error"
                                   ng-show="manageForm.job.$error.required">至少选择一个岗位</small></div></dd>
                    <dt>工作时限：</dt>
                    <dd class="input-modify dd-jobs" ng-click="clearInputs(); inputDuration = 1"><span ng-hide="inputDuration == 1 && status == 1">{{ durationMeaning }}&nbsp;</span><input type="hidden" name="duration" ng-model="mission.duration" required><ul ng-show="inputDuration == 1 && status == 1" class="ul-tag" id="inputDuration"><li ng-repeat="duration in durations" ng-class="{active: duration.active == true}" ng-click="durationClick($index)">{{ duration.name }}</li></ul><div class="warning"
                             ng-show="manageForm.duration.$invalid"><small class="error"
                                   ng-show="manageForm.duration.$error.required">至少选择一个时限</small></div></dd>
                    <dt>薪酬范围：</dt>
                    <dd class="input-modify" ng-click="clearInputs(); inputSalary = 1">
                        <span ng-hide="inputSalary == 1 && status == 1">{{ transSalary() }}&nbsp;</span>
                        <div ng-show="inputSalary == 1 && status == 1"  id="inputSalary">
                            <select class="form-control" ng-model="mission.salary1" ng-options="m.id as m.name for m in salary">
                                <!--<option value="">--请选择--</option>-->
                            </select>
                            <input type="tel" class="form-control" ng-show="mission.salary1 == 1" ng-model="mission.salary2" placeholder="输入薪酬数额">
                        </div>
                    </dd>
                    <dt>工作地点：</dt>
                    <dd class="input-modify" ng-click="clearInputs(); inputLocation = 1">
                        <span ng-hide="inputLocation == 1 && status == 1">{{ transLocation() }}&nbsp;</span>
                        <div ng-show="inputLocation == 1 && status == 1" class="row" id="inputLocation">
                            <div class="col-xs-4">
                                <select class="form-control" ng-model="mission.location1" ng-options="m.id as m.name for m in locations">
                                    <!--<option value="">--请选择--</option>-->
                                </select>
                            </div>
                            <div ng-show="mission.location1 == 3">
                                <div class="col-xs-4">
                                    <select id="selectP" class="form-control" ng-model="province" ng-options="m for m in provinces">
                                        <option value="">--省份--</option>
                                    </select>
                                </div>
                                <div class="col-xs-4">
                                    <select class="form-control" ng-model="city" ng-options="m for m in cities">
                                        <option value="">--城市--</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </dd>
                    <dt>详细描述：</dt>
                    <dd class="input-modify dd-jobs" ng-click="clearInputs(); inputDesc = 1"><span ng-hide="inputDesc == 1 && status == 1">{{ mission.description }}&nbsp;</span><textarea ng-show="inputDesc == 1 && status == 1" rows="4" id="inputDesc" class="form-control" ng-model="mission.description"></textarea></dd>
                </dl>
            </div>
        </div>

        <!-- Followers and receivers -->
        <div ng-switch="status">
            <div ng-switch-when="2">
                <div ng-show="mission.receive">
                    <div class="row">
                        <div class="col-xs-12 col-panel-resume">
                            <h5 class="text-receiver">已选的乙方</h5>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 wrap-col-cont">
                            <div class="row">
                                <div class="col-xs-12">
                                    <ul class="ul-float ul-user">
                                        <li ng-repeat="user in mission.receive" ng-click="getReceiverModal($index)">
                                            <img ng-src="__UPLOAD__/{{ user.image_url }}" width="45px" height="45px">
                                            <p class="text-name">
                                                {{ user.user_name }}
                                            </p>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div ng-show="mission.follow">
                    <div class="row">
                        <div class="col-xs-12 col-panel-resume">
                            <h5>申请的乙方</h5>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 wrap-col-cont">
                            <div class="row">
                                <div class="col-xs-12">
                                    <ul class="ul-float ul-user">
                                        <li ng-repeat="user in mission.follow" ng-click="getFollowerModal($index)">
                                            <img ng-src="__UPLOAD__/{{ user.image_url }}" width="45px" height="45px">
                                            <p class="text-name">
                                                {{ user.user_name }}
                                            </p>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="row wrap-col-cont" ng-switch="mission.status">
            <div ng-switch-when="2">
                <!--<div class="col-xs-12 center">-->
                    <!--<div ng-show="status == 1">-->
                        <!--<button class="btn btn-main-short" ng-click="submit()" ng-disabled="!modified || manageForm.$invalid">发布</button>-->
                        <!--<h6 ng-show="modified" class="text-tips">修改过，重新发布！</h6>-->
                    <!--</div>-->
                    <!--<div ng-hide="status == 1">-->
                        <!--<button class="btn btn-main-short" ng-click="modify()">修改</button>-->
                        <!--<h6 ng-show="modified" class="text-tips">修改过，重新发布！</h6>-->
                    <!--</div>-->
                <!--</div>-->
            </div>
            <div ng-switch-default>
                <div class="col-xs-6 right">
                    <div ng-show="status == 1">
                        <button class="btn btn-main-short" ng-click="submit()" ng-disabled="!modified || manageForm.$invalid">发布</button>
                        <h6 ng-show="modified" class="text-tips">修改过，重新发布！</h6>
                    </div>
                    <div ng-hide="status == 1">
                        <button class="btn btn-main-short" ng-click="modify()">修改</button>
                        <h6 ng-show="modified" class="text-tips">修改过，重新发布！</h6>
                    </div>
                </div>
                <div class="col-xs-6 left">
                    <button ng-hide="status == 1" class="btn btn-main-short" data-toggle="modal" data-target="#finishOptModal">结束任务</button>
                    <button ng-show="status == 1" class="btn btn-main-short" ng-click="manage()">返回管理</button>
                </div>
            </div>
        </div>
    </form>
    <!-- Modal Follower -->
    <div class="modal fade" id="followerModal" tabindex="-1" role="dialog" aria-labelledby="followerModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>-->
                    <div class="row modal-title" id="followerModalLabel">
                        <div class="col-xs-2 col-thin">
                            <img ng-src="__UPLOAD__/{{ follower.image_url }}" width="45px" height="45px">
                        </div>
                        <div class="col-xs-8 col-profile-head">
                            <h4>{{ follower.user_name }}</h4>
                            <span class="tag-level-first">甲.V{{ follower.level_j }}</span>
                            <span class="tag-level-second">乙.V{{ follower.level_y }}</span>
                        </div>
                        <div class="col-xs-2 col-thin center" ng-switch="follower.hasFavored">
                            <span class="icon-fav" ng-switch-when="1" ng-click="favUser(0)">收藏</span>
                            <span class="icon-fav-del" ng-switch-when="2" ng-click="delFavUser(0)">取消收藏</span>
                        </div>
                    </div>
                </div>
                <div class="modal-body">
                    <h6 class="text-tips">留言</h6>
                    <p>
                        {{ follower.message }}
                    </p>
                </div>
                <div class="modal-footer btn-group-card">
                    <button type="button" class="btn" ng-click="select()">就要Ta了</button>
                    <a role="button" href="<{:U('FetcherInfo/index')}>/user_id/{{ follower.user_id }}" class="btn" ng-click="select()">查看资料</a>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal Receiver -->
    <div class="modal fade" id="receiverModal" tabindex="-1" role="dialog" aria-labelledby="receiverModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>-->
                    <div class="row modal-title" id="receiverModalLabel">
                        <div class="col-xs-2 col-thin">
                            <img ng-src="__UPLOAD__/{{ receiver.image_url }}" width="45px" height="45px">
                        </div>
                        <div class="col-xs-8 col-profile-head">
                            <h4>{{ receiver.user_name }}</h4>
                            <span class="tag-level-first">甲.V{{ receiver.level_j }}</span>
                            <span class="tag-level-second">乙.V{{ receiver.level_y }}</span>
                        </div>
                        <div class="col-xs-2 col-thin center" ng-switch="receiver.hasFavored">
                            <span class="icon-fav" ng-switch-when="1" ng-click="favUser(1)">收藏</span>
                            <span class="icon-fav-del" ng-switch-when="2" ng-click="delFavUser(1)">取消收藏</span>
                        </div>
                    </div>
                </div>
                <div class="modal-body" ng-switch="receiver.hasEvaluated">
                </div>
                <div class="modal-footer btn-group-card">
                    <button type="button" class="btn" ng-click="refuse()">不满意，不要Ta</button>
                    <a role="button" href="<{:U('FetcherInfo/index')}>/user_id/{{ receiver.user_id }}" class="btn">查看资料</a>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal Finish Opts -->
    <div class="modal fade" id="finishOptModal" tabindex="-1" role="dialog" aria-labelledby="finishOptModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-footer btn-group-card btn-vertical">
                    <div>
                        <button type="button" class="btn" data-toggle="modal" data-target="#finishModal">谢谢活控，已找到人才</button>
                    </div>
                    <div>
                        <button type="button" class="btn" ng-click="finish(0)">没找到人才，结束活儿</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal Finish -->
    <div class="modal fade" id="finishModal" tabindex="-1" role="dialog" aria-labelledby="finishModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>-->

                </div>
                <div class="modal-body">
                    <div class="row modal-title" id="finishModalLabel">
                        <div ng-repeat="receiver in mission.receive" rater-filter>
                            <div class="col-xs-2 col-thin">
                                <img ng-src="__UPLOAD__/{{ receiver.image_url }}" width="45px" height="45px">
                            </div>
                            <div class="col-xs-8 col-profile-head">
                                <h4>{{ receiver.user_name }}</h4>
                                <span class="tag-level-first">甲.V{{ receiver.level_j }}</span>
                                <span class="tag-level-second">乙.V{{ receiver.level_y }}</span>
                            </div>
                            <div class="col-xs-2 col-thin center" ng-switch="receiver.hasFavored">
                                <span class="icon-fav" ng-switch-when="1" ng-click="favUser(1)">收藏</span>
                                <span class="icon-fav-del" ng-switch-when="2" ng-click="delFavUser(1)">取消收藏</span>
                            </div>
                            <div class="row">
                                <div class="col-xs-3 center">
                                    <span class="text-tips">满意度</span>
                                </div>
                                <div class="col-xs-9 col-thin">
                                    <p class="rank"></p>
                                    <input name="rank" class="rankNumber" type="hidden" ng-model="receiver.evaluate"/>
                                </div>
                            </div>
                            <!--<div class="row">-->
                                <!--<div class="col-xs-offset-3 col-xs-9 col-thin col-checkbox">-->
                                    <!--<div class="checkbox">-->
                                        <!--<label>-->
                                            <!--<input type="checkbox" ng-init="receiver.is_selected = false" ng-model="receiver.is_selected">不满意，不要Ta</a>-->
                                        <!--</label>-->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->
                        </div>

                        <div class="row">
                            <div class="col-xs-12">
                                <p class="text-tips">对乙方进行匿名评价，暂仅作为后台系统数据参考，请根据真实满意度进行评价。</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer btn-group-card btn-single">
                    <button type="button" class="btn" ng-click="finish(1)">完成</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__PUBLIC__/static/mobile/js/jquery.rater.js"></script>